/**
 * URL rewrite
 */
'use strict';
import proxy from 'http-proxy-middleware';

const routeProxy = proxy([
        '/home',
        '/software',
        '/hardware',
        '/users/login',
        '/users/register',
        'users/resetPwd',
      '/roadbook/roadbookHome'
    ], {
    target: 'http://127.0.0.1:8000',
    changeOrigin: true,
    logLevel: 'debug',
    pathRewrite: (path) => {
        return "/index.html";
    }
});


const serverProxy =  proxy([
        '/user',
       '/routePlan'
    ], {
    target: 'http://dev.leqibike.com:8090',
    changeOrigin: true,
    logLevel: 'debug',
    pathRewrite: {
        '^/': '/leqibike/'
    }
});

module.exports = {
    serverProxy: serverProxy,
    routeProxy: routeProxy
};
